package com20230215;

import java.util.Arrays;

public class Sort {
    public static void main(String[] args) {
        int[] arr1 = {2,1,3,4,8,6,9};
//        int[] arr2 = sort(arr1);
//        System.out.println(Arrays.toString(arr2));
        System.out.println(Arrays.toString(sort(arr1) ));
    }
    static int[] sort(int[] arr){
        for (int i = 0; i < arr.length - 1; i++) {
            for (int j = 0; j < arr.length - 1 - i; j++) {
                if (arr[j] > arr[j+1]){
                    int temp = 0;
                    temp = arr[j];
                    arr[j] = arr[j+1];
                    arr[j+1] = temp;
                }
            }
        }
        return arr;
    }
}
